//package com.yunxin.core.domain.service.product.impl;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.yunxin.core.domain.model.product.ProductInfo;
//import com.yunxin.core.domain.model.product.ProductInfoRepository;
//import com.yunxin.core.domain.model.product.ProductPromotionInfo;
//import com.yunxin.core.domain.model.product.ProductPromotionInfoRepository;
//import com.yunxin.core.domain.service.product.ProductService;
//import com.yunxin.core.infra.persistence.entity.product.ProductQualityConfig;
//import com.yunxin.core.infra.persistence.mapper.product.ProductQualityConfigMapper;
//import lombok.RequiredArgsConstructor;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
///**
// * @author zero°
// * @since 2023-05-31
// */
//@DS("core")
//@Service
//@RequiredArgsConstructor
//public class ProductServiceImpl implements ProductService {
//
//    private final ProductInfoRepository productInfoRepository;
//
//    private final ProductPromotionInfoRepository productPromotionInfoRepository;
//
//    private final ProductQualityConfigMapper productQualityConfigMapper;
//
//
//    @Override
//    @Transactional(rollbackFor = Exception.class)
//    public Long addProductPromotion(ProductInfo productInfo, ProductPromotionInfo productPromotionInfo) {
//        productInfoRepository.saveProductInfo(productInfo);
//        productPromotionInfo.setProductId(productInfo.getId());
//        productPromotionInfoRepository.saveProductPromotionInfo(productPromotionInfo);
//        Long productInfoId = productInfo.getId();
//
//        ProductQualityConfig productQualityConfig = new ProductQualityConfig();
//        productQualityConfig.setProductId(productInfoId);
//        productQualityConfigMapper.insert(productQualityConfig);
//        return productInfoId;
//    }
//
//    @Override
//    @Transactional(rollbackFor = Exception.class)
//    public boolean updateProductPromotion(ProductInfo productInfo, ProductPromotionInfo productPromotionInfo) {
//        boolean result = productInfoRepository.updateProductInfo(productInfo);
//        productPromotionInfo.setProductId(productInfo.getId());
//        boolean result1 = productPromotionInfoRepository.updateProductPromotionInfo(productPromotionInfo);
//        return result || result1;
//    }
//
//}
